import request from '@/utils/request';
import type {IOrder, IWechatOrder, IwxAppletPay} from '@/typings/interface';
import type {IPageRequest, OrderState} from '@/typings/api';

/**
 * 获取全部订单
 */
export function getOrders(req: IPageRequest & { state: OrderState | null }) {
    return request<IOrder, true>('/order/v1/list', {
        method: 'POST',
        data: req,
    });
}

/**
 * 微信支付 - APP
 */
export function wxPay(req: { id: number; type: string }) {
    return request<IWechatOrder>('/order/v1/pay', {
        method: 'POST',
        data: req,
    });
}

/**
 * 微信支付 - 小程序
 */
export function wxAppletPay(req: { id: number; type: string }) {
    return request<IwxAppletPay>('/order/v1/pay', {
        method: 'POST',
        data: req,
    });
}

